'use strict'

class hotTem {

    constructor() {
        this.param = '/'
    }
    //创建资源
    async get(c) {
        try{
            var a = [];
            var num = [3,6,7,4,1,5];
            var click = [33,29,25,19,17];
            for (var i = 0; i < 6; i++) {
                let sqltext1 =`SELECT *  FROM template WHERE template_id = '${num[i]}'`;
                var r1 = await c.service.psql.query(sqltext1)
                if (r1.rowCount === 0) {
                    return c.send('have no template')
                }
                r1.rows[0].click=click[i];
                a.push(r1.rows[0]);
            }            
            return c.send(a);
        }catch(err){
            console.log(err)
            return c.status(500).send('err');
        }
    }
}


module.exports = hotTem